package com.udima.reglocation;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;

import com.udima.reglocation.entities.User;
import com.udima.reglocation.LoginActivity;

public class RegisterActivity extends Activity {

    private TextView lblGotoLogin;
    private Button btnRegister;
    private EditText inputFullName;
    private EditText inputEmail;
    private EditText inputPassword;
    private TextView registerErrorMsg;    

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register);        

        inputFullName = (EditText) findViewById(R.id.txtUserName);
        inputEmail = (EditText) findViewById(R.id.txtEmail);
        inputPassword = (EditText) findViewById(R.id.txtPass);
        btnRegister = (Button) findViewById(R.id.btnRegister);

        registerErrorMsg = (TextView) findViewById(R.id.register_error);

        btnRegister.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                String name = inputFullName.getText().toString();
                String email = inputEmail.getText().toString();
                String password = inputPassword.getText().toString();
                User usuario = new User();
                /*
                usuario.setOnRegisterUsuario(new OnRegisterUsuario() {     
                	@Override
                    public void onRegisterFinish(JSONObject json, String msg) {
                     registerErrorMsg.setText("");
                     Intent itemintent = new Intent(RegisterActivity.this, MainActivity.class);
                 RegisterActivity.this.startActivity(itemintent);
                }     
                @Override
                public void onRegisterFail(String msg) {registerErrorMsg.setText(msg);}     
                @Override
                public void onRegisterException(Exception e, String msg) {registerErrorMsg.setText(msg);}
                });                
                usuario.register(RegisterActivity.this, name, email, password);
                */
            }
        });
        
        lblGotoLogin = (TextView) findViewById(R.id.link_to_login);
        lblGotoLogin.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
        	Intent itemintent = new Intent(RegisterActivity.this, LoginActivity.class);
        	RegisterActivity.this.startActivity(itemintent);}
        });
        
    }
 
}